package com.cn.jiyun.contoller;

import com.cn.jiyun.entity.pojo.Room;
import com.cn.jiyun.entity.pojo.Strategy;
import com.cn.jiyun.service.IHotelService;
import com.cn.jiyun.entity.pojo.Hotel;
import com.cn.jiyun.entity.vo.HotelVO;
import com.jiyun.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 【-Hotel】操作接口
 *
 * @author lxy
 * @since 2025-01-17
 */
@RestController
@RequestMapping("/hotel")
public class HotelController {

    @Autowired
    public IHotelService iHotelService;

    @PostMapping("/findAll")
    public Result<List<Hotel>> getList(@RequestBody HotelVO hotelVo) {
        List<Hotel> listAll = iHotelService.findAllList(hotelVo);
        return Result.ok(listAll);
    }
    @GetMapping("/findById/{Id}")
    public Result<Hotel> findById(@PathVariable("Id") Integer Id) {
        Hotel hotel = iHotelService.getHotelId(Id);
        return Result.ok(hotel);
    }
    @GetMapping("/findRoomById/{RoomId}")
    public Result<Room> findRoomById(@PathVariable("RoomId") Integer RoomId) {
        Room room = iHotelService.getRoomId(RoomId);
        return Result.ok(room);
    }

    @PostMapping("/selectRoom")
    public  Result<List<Room>> selectRoom(@RequestBody Room room){
        List<Room> list = iHotelService.selectRoom(room);
        return  Result.ok(list);
    }



}

